package com.zzedu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzedu.common.utils.StringUtils;
import com.zzedu.domain.ZzFormFieldChangeLog;
import com.zzedu.dto.ZzFormFieldChangeLogDTO;
import com.zzedu.mapper.ZzFormFieldChangeLogMapper;
import com.zzedu.service.IZzFormFieldChangeLogService;
import org.springframework.stereotype.Service;
/**
 * 字段变更日志Service业务层处理
 * 
 * @author Mr.Wang
 * @date 2025-05-31
 */
@Service
public class ZzFormFieldChangeLogServiceImpl extends ServiceImpl<ZzFormFieldChangeLogMapper,ZzFormFieldChangeLog> implements IZzFormFieldChangeLogService
{

    @Override
    public LambdaQueryWrapper<ZzFormFieldChangeLog> buildQuery(ZzFormFieldChangeLogDTO zzFormFieldChangeLog) {
        LambdaQueryWrapper<ZzFormFieldChangeLog> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(null!=zzFormFieldChangeLog.getRelationId(), ZzFormFieldChangeLog::getRelationId, zzFormFieldChangeLog.getRelationId());
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(zzFormFieldChangeLog.getRelationType()), ZzFormFieldChangeLog::getRelationType, zzFormFieldChangeLog.getRelationType());
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(zzFormFieldChangeLog.getField()), ZzFormFieldChangeLog::getField, zzFormFieldChangeLog.getField());
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(zzFormFieldChangeLog.getFieldCode()), ZzFormFieldChangeLog::getFieldCode, zzFormFieldChangeLog.getFieldCode());
        lambdaQueryWrapper.like(StringUtils.isNotBlank(zzFormFieldChangeLog.getBatchNo()), ZzFormFieldChangeLog::getBatchNo, zzFormFieldChangeLog.getBatchNo());
        lambdaQueryWrapper.like(StringUtils.isNotBlank(zzFormFieldChangeLog.getOperName()), ZzFormFieldChangeLog::getOperName, zzFormFieldChangeLog.getOperName());
        lambdaQueryWrapper.like(StringUtils.isNotBlank(zzFormFieldChangeLog.getOperAccNo()), ZzFormFieldChangeLog::getOperAccNo, zzFormFieldChangeLog.getOperAccNo());
        lambdaQueryWrapper.orderByDesc(ZzFormFieldChangeLog::getId);
        return lambdaQueryWrapper;
    }
}